<?php
	include('./config.php');
	include('./header.php');
	include('./mpd.php');
	
	# initiliaze mpd
	global $MPD;
	$MPD = new MPD($timeout=$cfg_mpd_timeout);

	// connect to mpd
	$connected = $MPD->connect($srv=$cfg_mpd_host,$port=$cfg_mpd_port);
	if ( is_null($connected) ) {
		response(500, PIMUSIC_ERROR );
	}
	else {
		$MPD->initRadios($radio_db=$cfg_radios_db);
	}

	print '<div id="menu">';
	print '<div id="controler">';
	print '<ul>';
	print '<li><img src="images/previous.png" onclick="javascript:previous_play()" /></li>';
	print '<li><img src="images/vol-down.png" onclick="javascript:volume_down()" /></li>';
	print '<li><img src="images/stop.png" onclick="javascript:stop_music()" /></li>';
	print '<li><img src="images/vol-up.png" onclick="javascript:volume_up()" /></li>';
	print '<li><img src="images/next.png" onclick="javascript:next_play()" /></li>';
	print '</ul>';
	print '<div id="current_music"><div onclick="javascript:pause_music()">'.$MPD->getState().'</div></div>';
	print '</div>';


	print '<div id="navigator">';
	print '<div><a onclick="javascript:load_page(1)">RADIOS</a> | <a onclick="javascript:load_page(2)">MUSIQUES</a></div>';
	print '</div>';

	print '</div>';

	print '<div id="page_container">';
	print '</div>';

	include('./footer.php');
?>
